
angular
    .module('app.service')
    .service('MarkTaskService', MarkTaskService);

MarkTaskService.$inject = ['API','$http'];
function MarkTaskService(API,$http) {
    var baseUrl = API+'marktasks';
    this.list = list;
    this.marking = marking;
    ////////////////

    function list(markerId,stage,questionId,done,sn) {
        var params = '?markerId='+markerId+'&stage='+stage+'&questionId='+questionId;
        if(done != undefined){
            params += '&done='+done;
        }
        if(sn){
            params += '&sn='+sn;
        }
        return $http.get(baseUrl+params);
    }

    function marking(markTaskId,stage,result){
        var data = {
            stage:stage,
            result:result
        }
        return $http.patch(baseUrl+'/'+markTaskId,data);
    }
}